/* GUI CONVERTED from rcctmtc.p (converter v1.76) Thu Apr 11 08:49:51 2002 */
/* rcctmtc.p - Release Management Customer Schedules                          */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.6.1.7 $                                                 */
/*V8:ConvertMode=Maintenance                                                  */
/* REVISION: 7.3    LAST MODIFIED: 06/01/93           BY: WUG *GB46*          */
/* REVISION: 7.3    LAST MODIFIED: 08/13/93           BY: WUG *GE19*          */
/* REVISION: 7.3    LAST MODIFIED: 10/19/94           BY: ljm *GN40*          */
/* REVISION: 7.3    LAST MODIFIED: 03/04/95           BY: jxz *G0GG*          */
/* REVISION: 8.6E   LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane            */
/* REVISION: 8.6E   LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan           */
/* REVISION: 8.6E   LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan           */
/* REVISION: 9.1    LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane     */
/* REVISION: 9.1    LAST MODIFIED: 05/12/00   BY: *N09X* Antony Babu          */
/* REVISION: 9.1    LAST MODIFIED: 07/10/00   BY: *N0FD* Inna Lyubarsky       */
/* REVISION: 9.1    LAST MODIFIED: 08/12/00   BY: *N0KP* Mark Brown           */
/* REVISION: 9.1    LAST MODIFIED: 09/05/00   BY: *N0R9* BalbeerS Rajput      */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* Revision: 1.6.1.6 BY: Jean Miller    DATE: 03/22/01 ECO: *P008*        */
/* $Revision: 1.6.1.7 $    BY: Patrick Rowan    DATE: 04/10/02 ECO: *P05C*        */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* GET REFERENCE (KANBAN) NUMBER FOR THIS CONTAINER */

{mfdeclre.i}
{gplabel.i} /* EXTERNAL LABEL INCLUDE */

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rcctmtc_p_4 "Reference"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

define input parameter abs_recid as recid.

define variable parent_id          as character.
define variable parent_shipfrom    as character.
define variable so_count           as integer.
define variable sod_count          as integer.
define variable consignment_orders like mfc_logical.
define variable sod_recid          as recid.

/* CONSIGNMENT VARIABLES */
{socnvars.i}

define variable ftitle             as character no-undo.

ftitle = getTermLabel("CONSIGNMENT_SHIP-TO_REF_FOR_ITEM",51).

find abs_mstr where recid(abs_mstr) = abs_recid exclusive-lock.

/* DETERMINE IF CUSTOMER CONSIGNMENT IS ACTIVE */
{gprun.i ""gpmfc01.p""
   "(input ENABLE_CUSTOMER_CONSIGNMENT,
     input 10,
     input ADG,
     input CUST_CONSIGN_CTRL_TABLE,
     output using_cust_consignment)"}
/*GUI*/ if global-beam-me-up then undo, leave.


assign
   parent_shipfrom = abs_shipfrom
   parent_id = abs_id.

/* SEE IF WE HAVE ANY CONSIGNMENT ORDERS */
for each abs_mstr no-lock where
         abs_shipfrom = parent_shipfrom and
         abs_par_id = parent_id         and
         abs_id begins "I"
use-index abs_par_id,
each sod_det no-lock where
     sod_nbr = abs_order and
     sod_line = integer(abs_line),
each so_mstr no-lock where
     so_nbr = sod_nbr
break by sod_nbr by sod_line:

   if first-of(sod_nbr) then do:
      so_count = so_count + 1.

      /* The consignment indicator is found at the Order   */
      /* Header when Customer Consignment is NOT used.     */
      /* When Customer Consignment is activated, the       */
      /* consignment indicator is found at the Order Line. */

      if not using_cust_consignment and so_consignment then
         consignment_orders = true.
      else
         if using_cust_consignment and sod_consignment then
            consignment_orders = true.
   end.  /* if first-of(sod_nbr) */

   if first-of(sod_line) then do:
      assign
         sod_count = sod_count + 1
         sod_recid = recid(sod_det).
   end.

end.

if sod_count = 0 then
   leave.

if not consignment_orders then
   leave.

if sod_count > 1 then do:
   /* More than one consignment order line item assigned     */
   /* to this ship container, unable to access ship schedule */
   {pxmsg.i &MSGNUM=4299 &ERRORLEVEL=2}
   {pxmsg.i &MSGNUM=4328 &ERRORLEVEL=1}
   bell.
   pause.
   leave.
end.

find sod_det where recid(sod_det) = sod_recid no-lock.

find abs_mstr where recid(abs_mstr) = abs_recid exclusive-lock.

find sch_mstr where
     sch_type = 2 and
     sch_nbr  = sod_nbr and
     sch_line = sod_line and
     sch_rlse_id = sod_curr_rlse_id[2]
no-lock no-error.

if not available sch_mstr then do:
   /* There is no active ship schedule for consignment order */
   {pxmsg.i &MSGNUM=4329 &ERRORLEVEL=2}
   bell.
   pause.
   leave.
end.

ftitle = ftitle + " " + sod_part + getFrameTitle("PO_NUMBER",20) + sod_contr_id.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
abs__qad04   format "x(24)" colon 20 label {&rcctmtc_p_4}
 SKIP(.4)  /*GUI*/
with frame a width 80 attr-space side-labels  NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = ftitle.
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

display
   abs__qad04
with frame a.

do on error undo, retry on endkey undo, leave with frame a:
/*GUI*/ if global-beam-me-up then undo, leave.


   set
      abs__qad04.

   find first schd_det where
              schd_type = sch_type and
              schd_nbr = sch_nbr and
              schd_line = sch_line and
              schd_rlse_id = sch_rlse_id and
              schd_reference = abs__qad04
   no-lock no-error.

   if not available schd_det then do:
      /* Ship Schedule record does not exist with this reference */
      {pxmsg.i &MSGNUM=4363 &ERRORLEVEL=3}
      bell.
      undo, retry.
   end.

end.
/*GUI*/ if global-beam-me-up then undo, leave.


hide frame a no-pause.
